#include "stdafx.h"
#include "SDLGmud.h"

void SDLGmud::OnEvent(SDL_Event* Event) 
{
	//We have event class setup, now link events to our new class structure
	GEvent::OnEvent(Event);

	//We have a window all setup, we're going to need a way to close it
	//if(Event->type == SDL_QUIT)
	//{
	//	Running = false;
	//}
}

void SDLGmud::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode)
{
	//The control of camera
	switch(sym)
	{
	case SDLK_UP:
		//GCamera::CameraControl.OnMove(0, 5);
		Player.MoveUp = true;
		break;
	case SDLK_DOWN:
		//GCamera::CameraControl.OnMove(0, -5);
		Player.MoveDown = true;
		break;
	case SDLK_LEFT:
		//GCamera::CameraControl.OnMove(5, 0);
		Player.MoveLeft = true;
		break;
	case SDLK_RIGHT:
		//GCamera::CameraControl.OnMove(-5, 0);
		Player.MoveRight = true;
		break;
	default:
		break;
	}
}

void SDLGmud::OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode)
{
	switch(sym)
	{
	case SDLK_UP:
		Player.MoveUp = false;
		break;
	case SDLK_DOWN:
		Player.MoveDown = false;
		break;
	case SDLK_LEFT:
		Player.MoveLeft = false;
		break;
	case SDLK_RIGHT:
		Player.MoveRight = false;
		break;
	default:
		break;
	}
}

void SDLGmud::OnExit()
{
	Running  = false;
}